import React, { useEffect, useState, useRef } from 'react';
import { View, Button, Input } from '@tarojs/components'
import './index.scss';
export default (props) => {
  const {
    onChange,
    require = true,
    label,
    value,
    placeholder = '--',
    option = []
  } = props;
  return <View className='FormCondition_radio_item'>
    <View className='FormCondition_radio_left'>
      {label}
      {require && <Text className='FormCondition_radio_leftRequire'>
        *
      </Text>}
    </View>
    <View className='FormCondition_radio_right'>

      {option.map((val, index) => {
        return <View onClick={() => {
          onChange(val.value, val)
        }} key={index} className='FormCondition_radio_selectItem'>
          <View className={value === val.value ? 'FormCondition_radio_selectCheck' : 'FormCondition_radio_selectNoCheck'}>

          </View>
          <View>  {val.label}</View>
        </View>
      })}


    </View>
  </View>
};
